// part1:C14:ex14.17.cpp
// class Date.
#include <iostream>
#include <fstream>
class Date
{
public:
    Date();
    Date(int y, int m, int d)
    {
        year = y;
        month = m;
        day = d;
    }
    friend istream& operator>>(istream &is, Date &dt);
    friend bool operator==(const Date &dl, const Date &dr);
    friend bool operator!=(const Date &dl, const Date &dr);
private:
    int year, month, day;
};

istream& operator>>(istream &is, Date &dt)
{
    is >> dt.year >> dt.month >> dt.day;
    if (!is) 
    {
        dt = Date(0, 0, 0);    
    }
    return is;
}

bool operator==(const Date &dl, const Date &dr)
{
    return dl.year == dr.year && dl.month == dr.month &&
        dl.day == dr.day;
}

bool operator!=(const Date &dl, const Date &dr)
{
    return !(dl == dr);
}
